package ru.moek.gui;

import java.awt.EventQueue;
import java.awt.TextField;

import javax.swing.DefaultListModel;
import javax.swing.JFrame;
import javax.swing.JTextPane;
import java.awt.BorderLayout;
import javax.swing.JTextField;
import javax.swing.JButton;
import net.miginfocom.swing.MigLayout;
import javax.swing.JMenuBar;
import javax.swing.JPanel;
import java.awt.Component;
import javax.swing.Box;
import java.awt.GridLayout;
import javax.swing.JList;
import javax.swing.AbstractAction;
import java.awt.event.ActionEvent;
import javax.swing.Action;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.border.TitledBorder;
import javax.swing.AbstractListModel;
import javax.swing.JDesktopPane;
import java.awt.FlowLayout;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EtchedBorder;

public class MainForm {

    private JFrame frmAisuDesktop;
    private JList list;
    private JComboBox comboBox;
    private JLabel lblNewLabel;

    /**
     * Launch the application.
     */
    public static void main(String[] args) {
	EventQueue.invokeLater(new Runnable() {
	    public void run() {
		try {
		    MainForm window = new MainForm();
		    window.frmAisuDesktop.setVisible(true);
		} catch (Exception e) {
		    e.printStackTrace();
		}
	    }
	});
    }

    /**
     * Create the application.
     */
    public MainForm() {
	initialize();
    }

    /**
     * Initialize the contents of the frame.
     */
    private void initialize() {
	frmAisuDesktop = new JFrame();
	frmAisuDesktop.setTitle("AISU Desktop");
	frmAisuDesktop.setBounds(100, 100, 799, 471);
	frmAisuDesktop.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	
	JMenuBar menuBar = new JMenuBar();
	frmAisuDesktop.setJMenuBar(menuBar);
	frmAisuDesktop.getContentPane().setLayout(new BorderLayout(0, 0));
	
	JPanel panel = new JPanel();
	panel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
	frmAisuDesktop.getContentPane().add(panel, BorderLayout.NORTH);
	
	lblNewLabel = new JLabel("\u0424\u0438\u043B\u0438\u0430\u043B\u044B");
	
	comboBox = new JComboBox();
	
	list = new JList();
	
	JLabel lblNewLabel_1 = new JLabel("\u0420\u0430\u0431\u043E\u0442\u043D\u0438\u043A\u0438");
	
	JButton btnNewButton = new JButton("New button");
	btnNewButton.addMouseListener(new MouseAdapter() {
		@Override
		public void mouseClicked(MouseEvent e) {
		    
		    //...
		}
	});
	GroupLayout gl_panel = new GroupLayout(panel);
	gl_panel.setHorizontalGroup(
		gl_panel.createParallelGroup(Alignment.LEADING)
			.addGroup(gl_panel.createSequentialGroup()
				.addContainerGap()
				.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
					.addComponent(lblNewLabel_1, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE)
					.addComponent(list, GroupLayout.PREFERRED_SIZE, 212, GroupLayout.PREFERRED_SIZE)
					.addComponent(comboBox, GroupLayout.PREFERRED_SIZE, 212, GroupLayout.PREFERRED_SIZE)
					.addComponent(lblNewLabel, GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE))
				.addGap(18)
				.addComponent(btnNewButton)
				.addGap(458))
	);
	gl_panel.setVerticalGroup(
		gl_panel.createParallelGroup(Alignment.LEADING)
			.addGroup(gl_panel.createSequentialGroup()
				.addContainerGap()
				.addComponent(lblNewLabel)
				.addPreferredGap(ComponentPlacement.RELATED)
				.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
					.addComponent(comboBox, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE)
					.addComponent(btnNewButton))
				.addGap(2)
				.addComponent(lblNewLabel_1)
				.addGap(2)
				.addComponent(list, GroupLayout.DEFAULT_SIZE, 345, Short.MAX_VALUE)
				.addContainerGap())
	);
	panel.setLayout(gl_panel);
	
	
	
    }

    private class SwingAction extends AbstractAction {
	public SwingAction() {
	    putValue(NAME, "SwingAction");
	    putValue(SHORT_DESCRIPTION, "Some short description");
	}

	public void actionPerformed(ActionEvent e) {
	}
    }
}
